<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>axios 实例化</title>
</head>
<body>
<div id="app">

</div>

<script src="../../../../js/axios.js"></script>
<script type="module">
    import {createApp, onMounted} from "../../../../js/vue.esm-browser.js";

    let app = createApp({
        setup() {
            let axiosInstance = axios.create(
                {
                    baseURL: "https://www.httpbin.org",
                    timeout: 5000,
                }
            );

            async function getRequest() {
                let response = await axiosInstance.get(
                    "/get",
                    {
                        params: {
                            name: "abcque",
                            age: 18,
                            gender: "M",
                        }
                    }
                );

                console.log(response);
            }

            onMounted(
                () => {
                    getRequest()
                }
            )

            return {}
        }
    })

    app.mount("#app")
</script>
</body>
</html>